package com.qqt.csr.file.service;

import com.qqt.csr.file.dto.MultipartUploadListingDTO;
import com.qqt.csr.file.vo.req.InitMultiUploadReq;
import com.qqt.csr.file.vo.req.UploadPartReq;

import java.io.InputStream;

/**
 * 分段上传服务
 */
public interface IMultipartFileService {
    /**
     * 初始化分段任务
     *
     * @param bucketName
     * @param req
     * @return
     */
    String initiateMultipartUpload(String bucketName, InitMultiUploadReq req);

    /**
     * 上传分段
     * @param bucketName
     * @param req
     * @param file
     */
    void uploadPart(String bucketName, UploadPartReq req, InputStream file);

    /**
     * 合并分段
     * @param bucketName
     * @param objectName
     * @param uploadId
     */
    String completeMultipartUpload(String bucketName, String objectName, String uploadId);

    /**
     * 取消分段上传任务
     * @param bucketName
     * @param objectName
     * @param uploadId
     */
    void abortMultipartUpload(String bucketName, String objectName, String uploadId);

    /**
     * 获取分段上传任务列表
     * @param bucketName
     * @param size 查询数量
     * @return
     */
    MultipartUploadListingDTO listMultipartUploads(String bucketName, String nextKeyMarker, String nextUploadIdMarker, int size);
}
